package com.youlu.campus.web.cms.controller;

import com.youlu.campus.web.cms.dto.BannerConfigRequest;
import com.youlu.campus.web.cms.service.BannerConfigService;
import com.yuelin.infrastructure.quantum.common.QResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Banner API
 *
 * @author: zhuhuaiqi
 * @date: 2020/12/8
 */
@RestController
public class BannerConfigController {
    @Autowired
    private BannerConfigService bannerConfigService;

    @PostMapping("/public/banner/list")
    public QResult list(@RequestBody BannerConfigRequest request) {
        return QResult.success(bannerConfigService.list(request));
    }

    @GetMapping("/mini-app/banner-info")
    public QResult bannerByLocation(@RequestParam String location) {
        return QResult.success(bannerConfigService.findByLocation(location));
    }
}
